import service from "../utils/request";
import {queryKey} from '../utils'

//  宿主机列表
export function getHostList(params:any) {
  const other = queryKey()
  return service.get(`/host`, { params:{...params, ...other} });
}
export function createHostList(data:any) {
  return service.post(`/host`, data);
}
export function editHostList(id:number,data:any) {
  return service.put(`/host/${id}`,data);
}
export function deleteHostList(id:number) {
  return service.delete(`/host/${id}`);
}
export function getHostListDetail(id:number,menu:any) {
  return service.get(`/${menu}/${id}`);
}
export function enable(id:number) {
  return service.put(`/host/${id}/enable`);
}
export function sync() {
  return service.put(`/host/sync`);
}
// 是否启用
export function updateStatus(id:number,data:any) {
  return service.put(`/host/${id}/enable`,data);
}
//  vm列表
export function byHostToVmList(params:any,id:number) {
  return service.get(`/host/${id}/vm`, { params });
}
// 宿主机-概览页
export function getAssignInfo(id:any,menu:any) {
  return service.get(`/${menu}/${id}/ratio`);
}
// 宿主机-硬件信息-基本信息&机房信息
export function getHardwareInfo(id:any) {
  return service.get(`/host/${id}/hardware/base-info`);
}
// 宿主机-硬件信息-设备信息和状态(附bios)
export function getDeviceInfo(id:any) {
  return service.get(`/host/${id}/hardware/item`);
}
// 宿主机-硬件信息-服务器日志
export function getServerLog(id:any,params:any) {
  return service.get(`/host/${id}/hardware/server-log`,{ params });
}
// 宿主机-硬件信息-审计日志
export function getchangeLog(id:any,params:any) {
  return service.get(`/host/${id}/hardware/change-log`,{ params });
}
// 储存列表
export function byHostToStorageList(params:any,id:number) {
  return service.get(`/host/${id}/storage`, { params });
}
// 网络vpc列表
export function byHostToVpcList(params:any,id:number) {
  return service.get(`/host/${id}/network/vpc`, { params });
}
// 储存subnet列表
export function byHostToSubnetList(params:any,id:number) {
  return service.get(`/host/${id}/network/subnet`, { params });
}